-- Ask the user to for the name and location of the new file
--
set newFile to choose new file with prompt "Pick a new file name:"
set newFilePath to (folder returned of newFile as string) & (name returned of newFile)
--
-- If the file already exists delete it
--
if (replacing of newFile) then ¬
delete file alias newFilePath
--
-- Create the file and write some data to it
--
create file (filename returned of newFile) in (folder returned of newFile) ¬
owner "ttxt" -- TeachText
set refNum to open file alias newFilePath
write file refNum text "This file is an example of a simple text file which can be created using the File I/O AppleScript additions provided in Script Tools"
write file refNum text ""
write file refNum text "-Mark"
close file refNum
--
-- Note how TeachText treats each line as a seperate paragraph.